/**
 * 生成编号类型
 *
 * @author 橘柚
 * @since 2025/3/19 09:35
 */

// 定义枚举
export enum SequenceType {
  ORDER = "ORDER",
  VENDOR = "VENDOR",
}

// 定义对应的类型
export interface SequenceTypeInfo {
  name: string;
  defPrefix: string;
  length: number;
}

// 映射枚举值到详细信息
export const SequenceTypeMap: Record<SequenceType, SequenceTypeInfo> = {
  [SequenceType.ORDER]: {name: "订单编号", length: 10, defPrefix: "ORDER"},
  [SequenceType.VENDOR]: {name: "供应商编号", length: 6, defPrefix: "VENDOR"},
};

export const getSequenceInfo = (type: SequenceType, prefix?: string): SequenceTypeInfo => {
  return {...SequenceTypeMap[type], defPrefix: prefix || SequenceTypeMap[type].defPrefix};
};
